﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-11-09 08:14:31
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
*********************************************************************/


using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
    /// <summary>
    /// Dal_yw_pfdH的摘要说明。
    /// </summary>
    public partial class Dal_yw_pfdH
    {
        /// <summary> 
        /// 更新一条数据(字符串) 2016-07-13更新 
        ///   2020-04-09 更新 minjie 
        /// </summary> 
        public string UpdateStr(yw_pfdH_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update yw_pfdH set ");
		
	   //  if (model.DjLsh != null) 
			 //strSql.Append(" DjLsh ='" + model.DjLsh + "',");
	 
	     if (model.DjBtZdh != null) 
			 strSql.Append(" DjBtZdh ='" + model.DjBtZdh + "',");
	 
	     if (model.DjFtZdh != null) 
			 strSql.Append(" DjFtZdh ='" + model.DjFtZdh + "',");
	 
	     if (model.DjStZdh != null) 
			 strSql.Append(" DjStZdh ='" + model.DjStZdh + "',");
	 
	     if (model.DjState != null) 
			 strSql.Append(" DjState ='" + model.DjState + "',");
	 
	     if (model.DjCount != null) 
			 strSql.Append(" DjCount ='" + model.DjCount + "',");
	 
	     if (model.xsrq != null) 
			 strSql.Append(" xsrq ='" + model.xsrq + "',");
	 
	     if (model.xssj != null) 
			 strSql.Append(" xssj ='" + model.xssj + "',");
	 
	     if (model.djzt != null) 
			 strSql.Append(" djzt ='" + model.djzt + "',");
	 
	     if (model.xsdh != null) 
			 strSql.Append(" xsdh ='" + model.xsdh + "',");
	 
	     if (model.bmbh != null) 
			 strSql.Append(" bmbh ='" + model.bmbh + "',");
	 
	     if (model.bmmc != null) 
			 strSql.Append(" bmmc ='" + model.bmmc + "',");
	 
	     if (model.ckbh != null) 
			 strSql.Append(" ckbh ='" + model.ckbh + "',");
	 
	     if (model.ckmc != null) 
			 strSql.Append(" ckmc ='" + model.ckmc + "',");
	 
	     if (model.khbh != null) 
			 strSql.Append(" khbh ='" + model.khbh + "',");
	 
	     if (model.khmc != null) 
			 strSql.Append(" khmc ='" + model.khmc + "',");
	 
	     if (model.tel != null) 
			 strSql.Append(" tel ='" + model.tel + "',");
	 
	     if (model.khqy != null) 
			 strSql.Append(" khqy ='" + model.khqy + "',");
	 
	     if (model.yyybh != null) 
			 strSql.Append(" yyybh ='" + model.yyybh + "',");
	 
	     if (model.yyyh != null) 
			 strSql.Append(" yyyh ='" + model.yyyh + "',");
	 
	     if (model.fplx != null) 
			 strSql.Append(" fplx ='" + model.fplx + "',");
	 
	     if (model.thydh != null) 
			 strSql.Append(" thydh ='" + model.thydh + "',");
	 
	     if (model.sjdr != null) 
			 strSql.Append(" sjdr ='" + model.sjdr + "',");
	 
	     if (model.slhj != null) 
			 strSql.Append(" slhj ='" + model.slhj + "',");
	 
	     if (model.jehj != null) 
			 strSql.Append(" jehj ='" + model.jehj + "',");
	 
	     if (model.cbjehj != null) 
			 strSql.Append(" cbjehj ='" + model.cbjehj + "',");
	 
	     if (model.zhjehj != null) 
			 strSql.Append(" zhjehj ='" + model.zhjehj + "',");
	 
	     if (model.jszje != null) 
			 strSql.Append(" jszje ='" + model.jszje + "',");
	 
	     if (model.ssjehj != null) 
			 strSql.Append(" ssjehj ='" + model.ssjehj + "',");
	 
	     if (model.bz != null) 
			 strSql.Append(" bz ='" + model.bz + "',");
	 
	     if (model.zdzk != null) 
			 strSql.Append(" zdzk ='" + model.zdzk + "',");
	 
	     if (model.zsz != null) 
			 strSql.Append(" zsz ='" + model.zsz + "',");
	 
	     if (model.zr != null) 
			 strSql.Append(" zr ='" + model.zr + "',");
	 
	     if (model.xj != null) 
			 strSql.Append(" xj ='" + model.xj + "',");
	 
	     if (model.qk != null) 
			 strSql.Append(" qk ='" + model.qk + "',");
	 
	     if (model.zl != null) 
			 strSql.Append(" zl ='" + model.zl + "',");
	 
	     if (model.ysk != null) 
			 strSql.Append(" ysk ='" + model.ysk + "',");
	 
	     if (model.wsk != null) 
			 strSql.Append(" wsk ='" + model.wsk + "',");
	 
	     if (model.yskye != null) 
			 strSql.Append(" yskye ='" + model.yskye + "',");
	 
	     if (model.djye != null) 
			 strSql.Append(" djye ='" + model.djye + "',");
	 
	     if (model.djzf != null) 
			 strSql.Append(" djzf ='" + model.djzf + "',");
	 
	     if (model.zdr != null) 
			 strSql.Append(" zdr ='" + model.zdr + "',");
	 
	     if (model.zdsj != null) 
			 strSql.Append(" zdsj ='" + model.zdsj + "',");
	 
	     if (model.shr != null) 
			 strSql.Append(" shr ='" + model.shr + "',");
	 
	     if (model.shsj != null) 
			 strSql.Append(" shsj ='" + model.shsj + "',");
	 
	     if (model.hkrq != null) 
			 strSql.Append(" hkrq ='" + model.hkrq + "',");
	 
	     if (model.hkbj != null) 
			 strSql.Append(" hkbj ='" + model.hkbj + "',");
	 
	     if (model.sjhm != null)
			 strSql.Append(" sjhm ='" + model.sjhm + "',");

			strSql= strSql.Remove(strSql.Length-1, 1);// = s.TrimEnd(',')

		strSql.Append(" where  DjLsh ='" + model.DjLsh + "' ");
        return strSql.ToString();
        }
		
		/// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="DjLsh">主键</param>
        /// <returns></returns>
        public bool Exists(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from yw_pfdH");  
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }
		public bool Exists(string xsdh, ref int djlsh)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select Djlsh from yw_pfdH");
			strSql.Append(" where  xsdh='" + xsdh + "' ");

			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj != null && obj.ToString() != "")
			{
				djlsh = int.Parse(obj.ToString());
				return true;
			}
			else
				return false;
		}

		/// <summary> 
		/// 增加一条数据 
		/// </summary> 
		public bool Add(yw_pfdH_Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yw_pfdH (");
			strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,xsrq,xssj,djzt,xsdh,bmbh,bmmc,ckbh,ckmc,khbh,khmc,tel,khqy,yyybh,yyyh,fplx,thydh,sjdr,slhj,jehj,cbjehj,zhjehj,jszje,ssjehj,bz,zdzk,zsz,zr,xj,qk,zl,ysk,wsk,yskye,djye,djzf,zdr,zdsj,shr,shsj,hkrq,hkbj, sjhm) values (");
	        strSql.Append("@DjLsh,@DjBtZdh,@DjFtZdh,@DjStZdh,@DjState,@DjCount,@xsrq,@xssj,@djzt,@xsdh,@bmbh,@bmmc,@ckbh,@ckmc,@khbh,@khmc,@tel,@khqy,@yyybh,@yyyh,@fplx,@thydh,@sjdr,@slhj,@jehj,@cbjehj,@zhjehj,@jszje,@ssjehj,@bz,@zdzk,@zsz,@zr,@xj,@qk,@zl,@ysk,@wsk,@yskye,@djye,@djzf,@zdr,@zdsj,@shr,@shsj,@hkrq,@hkbj,@sjhm) ");  
	        SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjFtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjStZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@DjCount",SqlDbType.Int,4),
	 
			new SqlParameter("@xsrq",SqlDbType.DateTime),
	 
			new SqlParameter("@xssj",SqlDbType.DateTime),
	 
			new SqlParameter("@djzt",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xsdh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@tel",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khqy",SqlDbType.VarChar,50),
	 
			new SqlParameter("@yyybh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@yyyh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@fplx",SqlDbType.VarChar,50),
	 
			new SqlParameter("@thydh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sjdr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@slhj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cbjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zhjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jszje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ssjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@bz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zdzk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zsz",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zr",SqlDbType.Decimal,9),
	 
			new SqlParameter("@xj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ysk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@wsk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@yskye",SqlDbType.Decimal,9),
	 
			new SqlParameter("@djye",SqlDbType.Decimal,9),
	 
			new SqlParameter("@djzf",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zdr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zdsj",SqlDbType.DateTime),
	 
			new SqlParameter("@shr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@shsj",SqlDbType.DateTime),
	 
			new SqlParameter("@hkrq",SqlDbType.DateTime),
	 
			new SqlParameter("@hkbj",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sjhm",SqlDbType.VarChar,50)
	 };
	 
	     if (model.DjLsh != null)
		 
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =DBNull.Value;
	 
	     if (model.DjBtZdh != null)
		 
            parameters[1].Value = model.DjBtZdh;
		else
		    parameters[1].Value =DBNull.Value;
	 
	     if (model.DjFtZdh != null)
		 
            parameters[2].Value = model.DjFtZdh;
		else
		    parameters[2].Value =DBNull.Value;
	 
	     if (model.DjStZdh != null)
		 
            parameters[3].Value = model.DjStZdh;
		else
		    parameters[3].Value =DBNull.Value;
	 
	     if (model.DjState != null)
		 
            parameters[4].Value = model.DjState;
		else
		    parameters[4].Value =DBNull.Value;
	 
	     if (model.DjCount != null)
		 
            parameters[5].Value = model.DjCount;
		else
		    parameters[5].Value =DBNull.Value;
	 
	     if (model.xsrq != null)
		 
            parameters[6].Value = model.xsrq;
		else
		    parameters[6].Value =DBNull.Value;
	 
	     if (model.xssj != null)
		 
            parameters[7].Value = model.xssj;
		else
		    parameters[7].Value =DBNull.Value;
	 
	     if (model.djzt != null)
		 
            parameters[8].Value = model.djzt;
		else
		    parameters[8].Value =DBNull.Value;
	 
	     if (model.xsdh != null)
		 
            parameters[9].Value = model.xsdh;
		else
		    parameters[9].Value =DBNull.Value;
	 
	     if (model.bmbh != null)
		 
            parameters[10].Value = model.bmbh;
		else
		    parameters[10].Value =DBNull.Value;
	 
	     if (model.bmmc != null)
		 
            parameters[11].Value = model.bmmc;
		else
		    parameters[11].Value =DBNull.Value;
	 
	     if (model.ckbh != null)
		 
            parameters[12].Value = model.ckbh;
		else
		    parameters[12].Value =DBNull.Value;
	 
	     if (model.ckmc != null)
		 
            parameters[13].Value = model.ckmc;
		else
		    parameters[13].Value =DBNull.Value;
	 
	     if (model.khbh != null)
		 
            parameters[14].Value = model.khbh;
		else
		    parameters[14].Value =DBNull.Value;
	 
	     if (model.khmc != null)
		 
            parameters[15].Value = model.khmc;
		else
		    parameters[15].Value =DBNull.Value;
	 
	     if (model.tel != null)
		 
            parameters[16].Value = model.tel;
		else
		    parameters[16].Value =DBNull.Value;
	 
	     if (model.khqy != null)
		 
            parameters[17].Value = model.khqy;
		else
		    parameters[17].Value =DBNull.Value;
	 
	     if (model.yyybh != null)
		 
            parameters[18].Value = model.yyybh;
		else
		    parameters[18].Value =DBNull.Value;
	 
	     if (model.yyyh != null)
		 
            parameters[19].Value = model.yyyh;
		else
		    parameters[19].Value =DBNull.Value;
	 
	     if (model.fplx != null)
		 
            parameters[20].Value = model.fplx;
		else
		    parameters[20].Value =DBNull.Value;
	 
	     if (model.thydh != null)
		 
            parameters[21].Value = model.thydh;
		else
		    parameters[21].Value =DBNull.Value;
	 
	     if (model.sjdr != null)
		 
            parameters[22].Value = model.sjdr;
		else
		    parameters[22].Value =DBNull.Value;
	 
	     if (model.slhj != null)
		 
            parameters[23].Value = model.slhj;
		else
		    parameters[23].Value =DBNull.Value;
	 
	     if (model.jehj != null)
		 
            parameters[24].Value = model.jehj;
		else
		    parameters[24].Value =DBNull.Value;
	 
	     if (model.cbjehj != null)
		 
            parameters[25].Value = model.cbjehj;
		else
		    parameters[25].Value =DBNull.Value;
	 
	     if (model.zhjehj != null)
		 
            parameters[26].Value = model.zhjehj;
		else
		    parameters[26].Value =DBNull.Value;
	 
	     if (model.jszje != null)
		 
            parameters[27].Value = model.jszje;
		else
		    parameters[27].Value =DBNull.Value;
	 
	     if (model.ssjehj != null)
		 
            parameters[28].Value = model.ssjehj;
		else
		    parameters[28].Value =DBNull.Value;
	 
	     if (model.bz != null)
		 
            parameters[29].Value = model.bz;
		else
		    parameters[29].Value =DBNull.Value;
	 
	     if (model.zdzk != null)
		 
            parameters[30].Value = model.zdzk;
		else
		    parameters[30].Value =DBNull.Value;
	 
	     if (model.zsz != null)
		 
            parameters[31].Value = model.zsz;
		else
		    parameters[31].Value =DBNull.Value;
	 
	     if (model.zr != null)
		 
            parameters[32].Value = model.zr;
		else
		    parameters[32].Value =DBNull.Value;
	 
	     if (model.xj != null)
		 
            parameters[33].Value = model.xj;
		else
		    parameters[33].Value =DBNull.Value;
	 
	     if (model.qk != null)
		 
            parameters[34].Value = model.qk;
		else
		    parameters[34].Value =DBNull.Value;
	 
	     if (model.zl != null)
		 
            parameters[35].Value = model.zl;
		else
		    parameters[35].Value =DBNull.Value;
	 
	     if (model.ysk != null)
		 
            parameters[36].Value = model.ysk;
		else
		    parameters[36].Value =DBNull.Value;
	 
	     if (model.wsk != null)
		 
            parameters[37].Value = model.wsk;
		else
		    parameters[37].Value =DBNull.Value;
	 
	     if (model.yskye != null)
		 
            parameters[38].Value = model.yskye;
		else
		    parameters[38].Value =DBNull.Value;
	 
	     if (model.djye != null)
		 
            parameters[39].Value = model.djye;
		else
		    parameters[39].Value =DBNull.Value;
	 
	     if (model.djzf != null)
		 
            parameters[40].Value = model.djzf;
		else
		    parameters[40].Value =DBNull.Value;
	 
	     if (model.zdr != null)
		 
            parameters[41].Value = model.zdr;
		else
		    parameters[41].Value =DBNull.Value;
	 
	     if (model.zdsj != null)
		 
            parameters[42].Value = model.zdsj;
		else
		    parameters[42].Value =DBNull.Value;
	 
	     if (model.shr != null)
		 
            parameters[43].Value = model.shr;
		else
		    parameters[43].Value =DBNull.Value;
	 
	     if (model.shsj != null)
		 
            parameters[44].Value = model.shsj;
		else
		    parameters[44].Value =DBNull.Value;
	 
	     if (model.hkrq != null)
		 
            parameters[45].Value = model.hkrq;
		else
		    parameters[45].Value =DBNull.Value;
	 
	     if (model.hkbj != null)
		 
            parameters[46].Value = model.hkbj;
		else
		    parameters[46].Value =DBNull.Value;
	 
	     if (model.sjhm != null)
		 
            parameters[47].Value = model.sjhm;
		else
		    parameters[47].Value =DBNull.Value;
	 
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 增加一条数据(字符串) 
        /// </summary> 
        public string AddStr(yw_pfdH_Entity model)
        {
		    StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yw_pfdH(");
			strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,xsrq,xssj,djzt,xsdh,bmbh,bmmc,ckbh,ckmc,khbh,khmc,tel,khqy,yyybh,yyyh,fplx,thydh,sjdr,slhj,jehj,cbjehj,zhjehj,jszje,ssjehj,bz,zdzk,zsz,zr,xj,qk,zl,ysk,wsk,yskye,djye,djzf,zdr,zdsj,shr,shsj,hkrq,hkbj, sjhm) values (");
            strSql.Append("'" + model.DjLsh + "','" + model.DjBtZdh + "','" + model.DjFtZdh + "','" + model.DjStZdh + "','" + model.DjState + "','" + model.DjCount + "','" + model.xsrq + "','" + model.xssj + "','" + model.djzt + "','" + model.xsdh + "','" + model.bmbh + "','" + model.bmmc + "','" + model.ckbh + "','" + model.ckmc + "','" + model.khbh + "','" + model.khmc + "','" + model.tel + "','" + model.khqy + "','" + model.yyybh + "','" + model.yyyh + "','" + model.fplx + "','" + model.thydh + "','" + model.sjdr + "','" + model.slhj + "','" + model.jehj + "','" + model.cbjehj + "','" + model.zhjehj + "','" + model.jszje + "','" + model.ssjehj + "','" + model.bz + "','" + model.zdzk + "','" + model.zsz + "','" + model.zr + "','" + model.xj + "','" + model.qk + "','" + model.zl + "','" + model.ysk + "','" + model.wsk + "','" + model.yskye + "','" + model.djye + "','" + model.djzf + "','" + model.zdr + "','" + model.zdsj + "','" + model.shr + "','" + model.shsj + "','" + model.hkrq + "','" + model.hkbj + "','" + model.sjhm + "') ");  
            return strSql.ToString();
        }
		/// <summary> 
        /// 更新一条数据 
		///创建时间:2020-04-09
		///创建人:minjie
        /// </summary> 
        public bool Update(yw_pfdH_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update yw_pfdH set ");
		strSql.Append(" DjLsh = @DjLsh,");
		 
	 strSql.Append(" DjBtZdh = @DjBtZdh,");
		 
	 strSql.Append(" DjFtZdh = @DjFtZdh,");
		 
	 strSql.Append(" DjStZdh = @DjStZdh,");
		 
	 strSql.Append(" DjState = @DjState,");
		 
	 strSql.Append(" DjCount = @DjCount,");
		 
	 strSql.Append(" xsrq = @xsrq,");
		 
	 strSql.Append(" xssj = @xssj,");
		 
	 strSql.Append(" djzt = @djzt,");
		 
	 strSql.Append(" xsdh = @xsdh,");
		 
	 strSql.Append(" bmbh = @bmbh,");
		 
	 strSql.Append(" bmmc = @bmmc,");
		 
	 strSql.Append(" ckbh = @ckbh,");
		 
	 strSql.Append(" ckmc = @ckmc,");
		 
	 strSql.Append(" khbh = @khbh,");
		 
	 strSql.Append(" khmc = @khmc,");
		 
	 strSql.Append(" tel = @tel,");
		 
	 strSql.Append(" khqy = @khqy,");
		 
	 strSql.Append(" yyybh = @yyybh,");
		 
	 strSql.Append(" yyyh = @yyyh,");
		 
	 strSql.Append(" fplx = @fplx,");
		 
	 strSql.Append(" thydh = @thydh,");
		 
	 strSql.Append(" sjdr = @sjdr,");
		 
	 strSql.Append(" slhj = @slhj,");
		 
	 strSql.Append(" jehj = @jehj,");
		 
	 strSql.Append(" cbjehj = @cbjehj,");
		 
	 strSql.Append(" zhjehj = @zhjehj,");
		 
	 strSql.Append(" jszje = @jszje,");
		 
	 strSql.Append(" ssjehj = @ssjehj,");
		 
	 strSql.Append(" bz = @bz,");
		 
	 strSql.Append(" zdzk = @zdzk,");
		 
	 strSql.Append(" zsz = @zsz,");
		 
	 strSql.Append(" zr = @zr,");
		 
	 strSql.Append(" xj = @xj,");
		 
	 strSql.Append(" qk = @qk,");
		 
	 strSql.Append(" zl = @zl,");
		 
	 strSql.Append(" ysk = @ysk,");
		 
	 strSql.Append(" wsk = @wsk,");
		 
	 strSql.Append(" yskye = @yskye,");
		 
	 strSql.Append(" djye = @djye,");
		 
	 strSql.Append(" djzf = @djzf,");
		 
	 strSql.Append(" zdr = @zdr,");
		 
	 strSql.Append(" zdsj = @zdsj,");
		 
	 strSql.Append(" shr = @shr,");
		 
	 strSql.Append(" shsj = @shsj,");
		 
	 strSql.Append(" hkrq = @hkrq,");
		 
	 strSql.Append(" hkbj = @hkbj,");
		 
	 strSql.Append(" sjhm = @sjhm");
			
	 
		  strSql.Append(" where  DjLsh =@DjLsh ");
		  SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjFtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjStZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@DjCount",SqlDbType.Int,4),
	 
			new SqlParameter("@xsrq",SqlDbType.DateTime),
	 
			new SqlParameter("@xssj",SqlDbType.DateTime),
	 
			new SqlParameter("@djzt",SqlDbType.VarChar,50),
	 
			new SqlParameter("@xsdh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@bmmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@tel",SqlDbType.VarChar,50),
	 
			new SqlParameter("@khqy",SqlDbType.VarChar,50),
	 
			new SqlParameter("@yyybh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@yyyh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@fplx",SqlDbType.VarChar,50),
	 
			new SqlParameter("@thydh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sjdr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@slhj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cbjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zhjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jszje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ssjehj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@bz",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zdzk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zsz",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zr",SqlDbType.Decimal,9),
	 
			new SqlParameter("@xj",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@ysk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@wsk",SqlDbType.Decimal,9),
	 
			new SqlParameter("@yskye",SqlDbType.Decimal,9),
	 
			new SqlParameter("@djye",SqlDbType.Decimal,9),
	 
			new SqlParameter("@djzf",SqlDbType.Decimal,9),
	 
			new SqlParameter("@zdr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@zdsj",SqlDbType.DateTime),
	 
			new SqlParameter("@shr",SqlDbType.VarChar,50),
	 
			new SqlParameter("@shsj",SqlDbType.DateTime),
	 
			new SqlParameter("@hkrq",SqlDbType.DateTime),
	 
			new SqlParameter("@hkbj",SqlDbType.VarChar,50),
	 
			new SqlParameter("@sjhm",SqlDbType.VarChar,50)
	 };
	 
	     if (model.DjLsh != null)
		 
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =DBNull.Value;
	 
	     if (model.DjBtZdh != null)
		 
            parameters[1].Value = model.DjBtZdh;
		else
		    parameters[1].Value =DBNull.Value;
	 
	     if (model.DjFtZdh != null)
		 
            parameters[2].Value = model.DjFtZdh;
		else
		    parameters[2].Value =DBNull.Value;
	 
	     if (model.DjStZdh != null)
		 
            parameters[3].Value = model.DjStZdh;
		else
		    parameters[3].Value =DBNull.Value;
	 
	     if (model.DjState != null)
		 
            parameters[4].Value = model.DjState;
		else
		    parameters[4].Value =DBNull.Value;
	 
	     if (model.DjCount != null)
		 
            parameters[5].Value = model.DjCount;
		else
		    parameters[5].Value =DBNull.Value;
	 
	     if (model.xsrq != null)
		 
            parameters[6].Value = model.xsrq;
		else
		    parameters[6].Value =DBNull.Value;
	 
	     if (model.xssj != null)
		 
            parameters[7].Value = model.xssj;
		else
		    parameters[7].Value =DBNull.Value;
	 
	     if (model.djzt != null)
		 
            parameters[8].Value = model.djzt;
		else
		    parameters[8].Value =DBNull.Value;
	 
	     if (model.xsdh != null)
		 
            parameters[9].Value = model.xsdh;
		else
		    parameters[9].Value =DBNull.Value;
	 
	     if (model.bmbh != null)
		 
            parameters[10].Value = model.bmbh;
		else
		    parameters[10].Value =DBNull.Value;
	 
	     if (model.bmmc != null)
		 
            parameters[11].Value = model.bmmc;
		else
		    parameters[11].Value =DBNull.Value;
	 
	     if (model.ckbh != null)
		 
            parameters[12].Value = model.ckbh;
		else
		    parameters[12].Value =DBNull.Value;
	 
	     if (model.ckmc != null)
		 
            parameters[13].Value = model.ckmc;
		else
		    parameters[13].Value =DBNull.Value;
	 
	     if (model.khbh != null)
		 
            parameters[14].Value = model.khbh;
		else
		    parameters[14].Value =DBNull.Value;
	 
	     if (model.khmc != null)
		 
            parameters[15].Value = model.khmc;
		else
		    parameters[15].Value =DBNull.Value;
	 
	     if (model.tel != null)
		 
            parameters[16].Value = model.tel;
		else
		    parameters[16].Value =DBNull.Value;
	 
	     if (model.khqy != null)
		 
            parameters[17].Value = model.khqy;
		else
		    parameters[17].Value =DBNull.Value;
	 
	     if (model.yyybh != null)
		 
            parameters[18].Value = model.yyybh;
		else
		    parameters[18].Value =DBNull.Value;
	 
	     if (model.yyyh != null)
		 
            parameters[19].Value = model.yyyh;
		else
		    parameters[19].Value =DBNull.Value;
	 
	     if (model.fplx != null)
		 
            parameters[20].Value = model.fplx;
		else
		    parameters[20].Value =DBNull.Value;
	 
	     if (model.thydh != null)
		 
            parameters[21].Value = model.thydh;
		else
		    parameters[21].Value =DBNull.Value;
	 
	     if (model.sjdr != null)
		 
            parameters[22].Value = model.sjdr;
		else
		    parameters[22].Value =DBNull.Value;
	 
	     if (model.slhj != null)
		 
            parameters[23].Value = model.slhj;
		else
		    parameters[23].Value =DBNull.Value;
	 
	     if (model.jehj != null)
		 
            parameters[24].Value = model.jehj;
		else
		    parameters[24].Value =DBNull.Value;
	 
	     if (model.cbjehj != null)
		 
            parameters[25].Value = model.cbjehj;
		else
		    parameters[25].Value =DBNull.Value;
	 
	     if (model.zhjehj != null)
		 
            parameters[26].Value = model.zhjehj;
		else
		    parameters[26].Value =DBNull.Value;
	 
	     if (model.jszje != null)
		 
            parameters[27].Value = model.jszje;
		else
		    parameters[27].Value =DBNull.Value;
	 
	     if (model.ssjehj != null)
		 
            parameters[28].Value = model.ssjehj;
		else
		    parameters[28].Value =DBNull.Value;
	 
	     if (model.bz != null)
		 
            parameters[29].Value = model.bz;
		else
		    parameters[29].Value =DBNull.Value;
	 
	     if (model.zdzk != null)
		 
            parameters[30].Value = model.zdzk;
		else
		    parameters[30].Value =DBNull.Value;
	 
	     if (model.zsz != null)
		 
            parameters[31].Value = model.zsz;
		else
		    parameters[31].Value =DBNull.Value;
	 
	     if (model.zr != null)
		 
            parameters[32].Value = model.zr;
		else
		    parameters[32].Value =DBNull.Value;
	 
	     if (model.xj != null)
		 
            parameters[33].Value = model.xj;
		else
		    parameters[33].Value =DBNull.Value;
	 
	     if (model.qk != null)
		 
            parameters[34].Value = model.qk;
		else
		    parameters[34].Value =DBNull.Value;
	 
	     if (model.zl != null)
		 
            parameters[35].Value = model.zl;
		else
		    parameters[35].Value =DBNull.Value;
	 
	     if (model.ysk != null)
		 
            parameters[36].Value = model.ysk;
		else
		    parameters[36].Value =DBNull.Value;
	 
	     if (model.wsk != null)
		 
            parameters[37].Value = model.wsk;
		else
		    parameters[37].Value =DBNull.Value;
	 
	     if (model.yskye != null)
		 
            parameters[38].Value = model.yskye;
		else
		    parameters[38].Value =DBNull.Value;
	 
	     if (model.djye != null)
		 
            parameters[39].Value = model.djye;
		else
		    parameters[39].Value =DBNull.Value;
	 
	     if (model.djzf != null)
		 
            parameters[40].Value = model.djzf;
		else
		    parameters[40].Value =DBNull.Value;
	 
	     if (model.zdr != null)
		 
            parameters[41].Value = model.zdr;
		else
		    parameters[41].Value =DBNull.Value;
	 
	     if (model.zdsj != null)
		 
            parameters[42].Value = model.zdsj;
		else
		    parameters[42].Value =DBNull.Value;
	 
	     if (model.shr != null)
		 
            parameters[43].Value = model.shr;
		else
		    parameters[43].Value =DBNull.Value;
	 
	     if (model.shsj != null)
		 
            parameters[44].Value = model.shsj;
		else
		    parameters[44].Value =DBNull.Value;
	 
	     if (model.hkrq != null)
		 
            parameters[45].Value = model.hkrq;
		else
		    parameters[45].Value =DBNull.Value;
	 
	     if (model.hkbj != null)
		 
            parameters[46].Value = model.hkbj;
		else
		    parameters[46].Value =DBNull.Value;
	 
	     if (model.sjhm != null)
		 
            parameters[47].Value = model.sjhm;
		else
		    parameters[47].Value =DBNull.Value;
	 
	             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 删除一条数据 
        /// </summary> 
        public bool Delete(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from yw_pfdH ");
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 批量删除一批数据 
        /// </summary> 
        public bool DeleteList(string lists)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from sys_Config ");
            strSql.Append(" where DjLsh in (" + lists + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		
		/// <summary> 
        /// 得到一个对象实体 
        /// </summary> 
        public yw_pfdH_Entity GetModel(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1  DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,xsrq,xssj,djzt,xsdh,bmbh,bmmc,ckbh,ckmc,khbh,khmc,tel,khqy,yyybh,yyyh,fplx,thydh,sjdr,slhj,jehj,cbjehj,zhjehj,jszje,ssjehj,bz,zdzk,zsz,zr,xj,qk,zl,ysk,wsk,yskye,djye,djzf,zdr,zdsj,shr,shsj,hkrq,hkbj, sjhm ");
            strSql.Append(" from yw_pfdH ");
            yw_pfdH_Entity model = new yw_pfdH_Entity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            DataTable dt = ds.Tables[0];
            return DataTableToEntity(dt);
        }
		/// <summary> 
        /// 将数据集(DataTable)转换 对象 yw_pfdH_Entity
        /// 创建人：minjie 
        /// 创建时间:2019-02-18 02:05:58 
        /// </summary> 
        public yw_pfdH_Entity DataTableToEntity(DataTable dt)
        {
          yw_pfdH_Entity model = new yw_pfdH_Entity();
            if (dt != null && dt.Rows.Count > 0)
            {
		    
			   if (dt.Rows[0]["DjLsh"] != null && dt.Rows[0]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[0]["DjLsh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjBtZdh"] != null && dt.Rows[0]["DjBtZdh"].ToString() != "")
                model.DjBtZdh = int.Parse(dt.Rows[0]["DjBtZdh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjFtZdh"] != null && dt.Rows[0]["DjFtZdh"].ToString() != "")
                model.DjFtZdh = int.Parse(dt.Rows[0]["DjFtZdh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjStZdh"] != null && dt.Rows[0]["DjStZdh"].ToString() != "")
                model.DjStZdh = int.Parse(dt.Rows[0]["DjStZdh"].ToString());
			  
	        model.DjState = dt.Rows[0]["DjState"].ToString();
	        
			   if (dt.Rows[0]["DjCount"] != null && dt.Rows[0]["DjCount"].ToString() != "")
                model.DjCount = int.Parse(dt.Rows[0]["DjCount"].ToString());
			  
	        if (dt.Rows[0]["xsrq"] != null && dt.Rows[0]["xsrq"].ToString() != "")
			  model.xsrq = DateTime.Parse(dt.Rows[0]["xsrq"].ToString());
			  
	        if (dt.Rows[0]["xssj"] != null && dt.Rows[0]["xssj"].ToString() != "")
			  model.xssj = DateTime.Parse(dt.Rows[0]["xssj"].ToString());
			  
	        model.djzt = dt.Rows[0]["djzt"].ToString();
	        model.xsdh = dt.Rows[0]["xsdh"].ToString();
	        model.bmbh = dt.Rows[0]["bmbh"].ToString();
	        model.bmmc = dt.Rows[0]["bmmc"].ToString();
	        model.ckbh = dt.Rows[0]["ckbh"].ToString();
	        model.ckmc = dt.Rows[0]["ckmc"].ToString();
	        model.khbh = dt.Rows[0]["khbh"].ToString();
	        model.khmc = dt.Rows[0]["khmc"].ToString();
	        model.tel = dt.Rows[0]["tel"].ToString();
	        model.khqy = dt.Rows[0]["khqy"].ToString();
	        model.yyybh = dt.Rows[0]["yyybh"].ToString();
	        model.yyyh = dt.Rows[0]["yyyh"].ToString();
	        model.fplx = dt.Rows[0]["fplx"].ToString();
	        model.thydh = dt.Rows[0]["thydh"].ToString();
	        model.sjdr = dt.Rows[0]["sjdr"].ToString();
	        if (dt.Rows[0]["slhj"] != null && dt.Rows[0]["slhj"].ToString() != "")
			  model.slhj = decimal.Parse(dt.Rows[0]["slhj"].ToString());
			
	        if (dt.Rows[0]["jehj"] != null && dt.Rows[0]["jehj"].ToString() != "")
			  model.jehj = decimal.Parse(dt.Rows[0]["jehj"].ToString());
			
	        if (dt.Rows[0]["cbjehj"] != null && dt.Rows[0]["cbjehj"].ToString() != "")
			  model.cbjehj = decimal.Parse(dt.Rows[0]["cbjehj"].ToString());
			
	        if (dt.Rows[0]["zhjehj"] != null && dt.Rows[0]["zhjehj"].ToString() != "")
			  model.zhjehj = decimal.Parse(dt.Rows[0]["zhjehj"].ToString());
			
	        if (dt.Rows[0]["jszje"] != null && dt.Rows[0]["jszje"].ToString() != "")
			  model.jszje = decimal.Parse(dt.Rows[0]["jszje"].ToString());
			
	        if (dt.Rows[0]["ssjehj"] != null && dt.Rows[0]["ssjehj"].ToString() != "")
			  model.ssjehj = decimal.Parse(dt.Rows[0]["ssjehj"].ToString());
			
	        model.bz = dt.Rows[0]["bz"].ToString();
	        if (dt.Rows[0]["zdzk"] != null && dt.Rows[0]["zdzk"].ToString() != "")
			  model.zdzk = decimal.Parse(dt.Rows[0]["zdzk"].ToString());
			
	        if (dt.Rows[0]["zsz"] != null && dt.Rows[0]["zsz"].ToString() != "")
			  model.zsz = decimal.Parse(dt.Rows[0]["zsz"].ToString());
			
	        if (dt.Rows[0]["zr"] != null && dt.Rows[0]["zr"].ToString() != "")
			  model.zr = decimal.Parse(dt.Rows[0]["zr"].ToString());
			
	        if (dt.Rows[0]["xj"] != null && dt.Rows[0]["xj"].ToString() != "")
			  model.xj = decimal.Parse(dt.Rows[0]["xj"].ToString());
			
	        if (dt.Rows[0]["qk"] != null && dt.Rows[0]["qk"].ToString() != "")
			  model.qk = decimal.Parse(dt.Rows[0]["qk"].ToString());
			
	        if (dt.Rows[0]["zl"] != null && dt.Rows[0]["zl"].ToString() != "")
			  model.zl = decimal.Parse(dt.Rows[0]["zl"].ToString());
			
	        if (dt.Rows[0]["ysk"] != null && dt.Rows[0]["ysk"].ToString() != "")
			  model.ysk = decimal.Parse(dt.Rows[0]["ysk"].ToString());
			
	        if (dt.Rows[0]["wsk"] != null && dt.Rows[0]["wsk"].ToString() != "")
			  model.wsk = decimal.Parse(dt.Rows[0]["wsk"].ToString());
			
	        if (dt.Rows[0]["yskye"] != null && dt.Rows[0]["yskye"].ToString() != "")
			  model.yskye = decimal.Parse(dt.Rows[0]["yskye"].ToString());
			
	        if (dt.Rows[0]["djye"] != null && dt.Rows[0]["djye"].ToString() != "")
			  model.djye = decimal.Parse(dt.Rows[0]["djye"].ToString());
			
	        if (dt.Rows[0]["djzf"] != null && dt.Rows[0]["djzf"].ToString() != "")
			  model.djzf = decimal.Parse(dt.Rows[0]["djzf"].ToString());
			
	        model.zdr = dt.Rows[0]["zdr"].ToString();
	        if (dt.Rows[0]["zdsj"] != null && dt.Rows[0]["zdsj"].ToString() != "")
			  model.zdsj = DateTime.Parse(dt.Rows[0]["zdsj"].ToString());
			  
	        model.shr = dt.Rows[0]["shr"].ToString();
	        if (dt.Rows[0]["shsj"] != null && dt.Rows[0]["shsj"].ToString() != "")
			  model.shsj = DateTime.Parse(dt.Rows[0]["shsj"].ToString());
			  
	        if (dt.Rows[0]["hkrq"] != null && dt.Rows[0]["hkrq"].ToString() != "")
			  model.hkrq = DateTime.Parse(dt.Rows[0]["hkrq"].ToString());
			  
	        model.hkbj = dt.Rows[0]["hkbj"].ToString();
	        model.sjhm = dt.Rows[0]["sjhm"].ToString();
	        
                return model;
            }
            else
            {
                return null;
            }
        }
		
		
		
		/// <summary> 
        /// 执行sql语句  
        /// </summary> 
        public string GetSingle(string sql)
        {
            object obj = DbHelperSQL.GetSingle(sql);
            if (obj != null)
            {
                return obj.ToString();
            }
            else
                return "";
        }
			/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		} 
   
 
   
  		/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public DataTable ExecuteDt(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteDt(sql); 
  		} 
		
		/// <summary> 
        /// 获得记录条数 
        /// </summary> 
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) ");
            strSql.Append(" FROM yw_pfdH ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj != null && obj.ToString() != "")
                return Convert.ToInt32(obj);
            else
                return 0;
        }
		/// <summary> 
        /// 批量处理  
        /// </summary> 
        public int ExecuteSqlTran(List<string> ls, ref string error)
        {
            return DbHelperSQL.ExecuteSqlTran(ls, ref error);
        }
		/// <summary> 
        /// 分页获取数据列表 
        /// </summary> 
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by " + orderby);
            }
            else
            {
                strSql.Append("order by T.DjLsh desc");
            }
            strSql.Append(")AS Row, T.*  from yw_pfdH  T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); 
			return DbHelperSQL.Query(strSql.ToString());
        }
		/// <summary> 
        /// 获得数据列表 
        /// </summary> 
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM yw_pfdH ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }
	}
}
		